home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 2002 November / SGI IRIX 6.5 Applications 2002 November.iso / dist / cosmocreate.idb / usr / share / CosmoCreate / buttons / ExampleButton.z / ExampleButton
Encoding:
Text File  |  1998-05-07  |  2.8 KB  |  122 lines

  1. #Inventor V2.1 ascii
  2.  
  3. DEF BM_Root Separator {
  4.  
  5. #
  6. # To be a valid button file, the top level Separator
  7. # must be called BM_Root. The letter "B" must be
  8. # the 26th character in the file to be recognized
  9. # by the filetyping rules (otherwise, the desktop
  10. # will assume it is an Inventor file.
  11. #
  12. # Note that this file cannot be loaded into Inventor
  13. # because it depends on several highly specialized nodes
  14. #
  15.  
  16.  
  17. #
  18. # The light group contains all lights. Any lights 
  19. # found outside this group will be seen but will not
  20. # be editable. 
  21. # The group must be named "LightGroup"
  22. # Placing nodes other than lights into this group
  23. # will have unpredictable results.
  24. #
  25.   DEF LightGroup Group {
  26.     DirectionalLight {
  27.       on    TRUE
  28.     }
  29.     DirectionalLight {
  30.       on    TRUE
  31.     }
  32.   }
  33.  
  34.  
  35. #
  36. # The CoTextGraph. Essentially an SoText3 node with some smarts...
  37. #
  38.   DEF theObject Separator {
  39.     DEF theTextGraph CoTextGraph {
  40.       textType    1
  41.       string    "Sample Text"
  42.       fontName    "Palatino-Roman;HonMinchoLtBT--H;HonMinchoLtBT--Hankaku"
  43.       fontStyle          FontStyle {
  44.     size    18
  45.     style    ""
  46.     justify    "MIDDLE"
  47.     spacing    1
  48.       }
  49.     }
  50.   }
  51.  
  52. #
  53. # The button part of the scene
  54. #
  55.   Separator {
  56.     #
  57.     # The name given to the CoMultiButton
  58.     # is the title of the button that appears
  59.     # in the Button Shape text field within
  60.     # Button Magic... (in this case "ExampleButton")
  61.     DEF ExampleButton CoMultiButton {
  62.       geometry          Separator {
  63.  
  64.     #
  65.     # This transform must exist and be placed
  66.     # here to be recognized by the button-sizing code 
  67.     #
  68.     Transform { }
  69.  
  70.     #
  71.     # Below are all of the shapes that the 
  72.     # button can take on, sorted in order
  73.     # of increasing aspect ratio (width/height) 
  74.     #
  75.     # As the aspect ratio of the required
  76.     # button changes, Button Magic will automatically 
  77.     # choose the closest geometry. Hence, the geometry 
  78.     # MUST appear under a switch node and MUST be 
  79.     # sorted by  aspect ratio. 
  80.     #
  81.     # Typically, materials should not be put 
  82.     # inside this geometry, since they will
  83.     # override those set by button magic.
  84.     # They're used here to show when button magic
  85.     # switches between geometry.
  86.     #
  87.     
  88.         Switch {
  89.       # First geometry... a blue cube, 1.0 aspect
  90.       Separator {
  91.         Material { diffuseColor 0.0 0.0 1.0 }
  92.         Cube { width 1 }
  93.       }
  94.  
  95.       # Second geometry... a red cube, 4.0 aspect
  96.       Separator {
  97.         Material { diffuseColor 1.0 0.0 0.0 }
  98.         Transform { scaleFactor 4.0 1.0 1.0 }
  99.         Cube { width 1 }
  100.       }
  101.  
  102.       # Third geometry... a yello cube, 8.0 aspect
  103.       Separator {
  104.         Material { diffuseColor 1.0 1.0 0.0 }
  105.         Cube { width 8 }
  106.       }
  107.  
  108.       # And so on...
  109.         }
  110.       }
  111.  
  112.       #
  113.       # This must point to the CoTextGraph, wherever it is
  114.       # in the scene graph. The CoMultiButton monitors it 
  115.       # for changes so it may configure the above geometry.
  116.       #
  117.       attachTo          USE theTextGraph
  118.  
  119.     }
  120.   }
  121. }
  122.